<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.w3.org/1999/xhtml">
<html>
<head>
    <meta charset="UTF-8">
    <title>商城首页</title>
    <link type="text/css" rel="stylesheet" href="/static/css/style2.css" >
    <script type="text/javascript" src="/static/js/jquery-1.8.3.min.js"></script>
    <link type="text/css" rel="stylesheet" href="/css/style.css" />
    <link th:href="@{/bootstrap-3.3.7-dist/css/bootstrap.min.css}" rel="stylesheet">
    <script type="text/javascript" th:src="@{/webjars/jquery/3.3.1/jquery.js}"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"
            integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
            crossorigin="anonymous"></script>
</head>
<body>
<div id="header">
    <img class="logo_img" alt="" src="/static/img/logo.jpg" >
    <span class="wel_word">网上商城</span>
    <div>
        <span>欢迎<span class="um_span" th:text="${session.shopInfo.name}"></span>光临尚硅谷书城</span>
        <a href="/shop/getOrder">我的订单</a>
        <a href="/shop/shoplogout">注销</a>&nbsp;&nbsp;
        <a href="/shop/bookList">返回</a>
    </div>
</div>

<div id="main">
    <div id="book">
        <div class="book_cond">
            <form action="#" method="get">
                <input type="hidden" name="action" value="pageByPrice">
                价格：<input id="min" type="text" name="min"> 元 -
                <input id="max" type="text" name="max"> 元
                <input type="submit" value="查询" />
            </form>
        </div>
        <div style="text-align: center">
        <span th:each="book:${session.books}">
            <div class="b_list">
                <div class="img_div">
                    <img class="book_img" alt="" th:src="${book.imgPath}" />
                </div>
                <div class="book_info">
                    <div class="book_name">
                        <span class="sp1">书名:</span>
                        <span class="sp2" th:text="${book.name}"></span>
                    </div>
                    <div class="book_author">
                        <span class="sp1">作者:</span>
                        <span class="sp2" th:text="${book.author}"></span>
                    </div>
                    <div class="book_price">
                        <span class="sp1">价格:</span>
                        ￥<span class="sp2" th:text="${book.price}"></span>
                    </div>
                    <div class="book_sales">
                        <span class="sp1">销量:</span>
                        <span class="sp2" th:text="${book.sales}"></span>
                    </div>
                    <div class="book_amount">
                        <span class="sp1">库存:</span>
                        <span class="sp2" th:text="${book.stock}"></span>
                    </div>
                    <div class="book_add">
                        <a class="addToCart" th:href="@{/shop/addTocart(id=${book.id})}" >购买</a>
                    </div>
                </div>
            </div>
        </span>
            <!-- 显示分页信息 -->
            <div class="row">
                <!--分页文字信息  -->
                <div class="col-md-6" id="page_info_area">
                    当前<span th:text="${session.pageInfo.pageNum}"></span>页，
                    总<span th:text="${session.pageInfo.pages}"></span>页，
                    总<span th:text="${session.pageInfo.total}"></span>条记录
                </div>
                <!-- 分页条信息 -->
                <div class="col-md-6" id="page_nav_area">
                    <ul class="pagination">
                        <li><a th:href="@{/shop/bookList(pn=${session.pageInfo.getFirstPage()})}">首页</a></li>
                        <li><a th:href="@{/shop/bookList(pn=${session.pageInfo.getPrePage()})}">&laquo;</a></li>
                        <li th:each="p : ${session.pageInfo.navigatepageNums}">
                            <a th:text="${p}" th:href="@{/shop/bookList(pn=${p})}"> </a>
                        </li>
                        <li><a th:href="@{/shop/bookList(pn=${session.pageInfo.getLastPage()})}">末页</a></li>
                    </ul>
                </div>
            </div>
    </div>

</div>
</div>
</body>
</html>